package forkJoinDemo.kill;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class KillProduct {

    private Long spuId;

    private String tilte;

    private LocalDateTime creatTime;

    private BigDecimal price;

    private Integer stock;


    public static List<KillProduct> killProductList=new ArrayList<>();
    static {
        KillProduct killProduct1=new KillProduct(1L,"商品1",LocalDateTime.now(),new BigDecimal(1),1);
        KillProduct killProduct2=new KillProduct(2L,"商品2",LocalDateTime.now().minusDays(1),new BigDecimal(2),2);
        KillProduct killProduct3=new KillProduct(5L,"商品5",LocalDateTime.now().plusHours(2),new BigDecimal(6),6);
        KillProduct killProduct4=new KillProduct(8L,"商品8",LocalDateTime.now().minusHours(2),new BigDecimal(8),8);
        KillProduct killProduct5=new KillProduct(11L,"商品11",LocalDateTime.now().minusDays(11),new BigDecimal(11),11);
        killProductList.add(killProduct1);
        killProductList.add(killProduct2);
        killProductList.add(killProduct3);
        killProductList.add(killProduct4);
        killProductList.add(killProduct5);


    }

    /**
     * 默认的打印顺序是：
     * KillProduct(spuId=1, tilte=商品1, creatTime=2021-04-02T19:38:41.064, price=1, stock=1)
     * KillProduct(spuId=2, tilte=商品2, creatTime=2021-04-01T19:38:41.064, price=2, stock=2)
     * KillProduct(spuId=5, tilte=商品5, creatTime=2021-04-02T21:38:41.064, price=6, stock=6)
     * KillProduct(spuId=8, tilte=商品8, creatTime=2021-04-02T17:38:41.064, price=8, stock=8)
     * KillProduct(spuId=11, tilte=商品11, creatTime=2021-03-22T19:38:41.064, price=11, stock=11)
     */
    public static void main(String[] args) {
        killProductList.forEach(v-> System.out.println(v));
    }
}
